﻿<sap:ActivityDesigner x:Class="WFTestDesign.Activities.Designers.MySequenceDesigner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
    
    xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation">
    <sap:ActivityDesigner.Resources>
        <Style x:Key="mysequence" TargetType="sap:WorkflowItemsPresenter">
            <Style.Setters>
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Vertical"/>
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="SpacerTemplate">
                    <Setter.Value>
                      <!--  <DataTemplate>
                            <StackPanel>
                            <Polygon Margin="5"
                                Points="-5,5 0,10 5,5"
                                Stroke="Gray" 
                                StrokeThickness="2" HorizontalAlignment="Center" >
                            </Polygon>
                            </StackPanel>
                        </DataTemplate> -->
                        <DataTemplate>
                            <!-- 
                         StackPanel utilisé pour étandre la zone de drag and drop d'activité
                         au dela du simple Polygon
                         -->
                            <StackPanel Background="White">
                                <Polygon HorizontalAlignment="Center" Margin="5" Fill="White" Stroke="Gray" Points="0,0 16,0 8,8" />
                            </StackPanel>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style.Setters>
        </Style>
    </sap:ActivityDesigner.Resources>
    <StackPanel>
        <Border BorderBrush="Green" BorderThickness="4" CornerRadius="5" Margin="0 5">
            <StackPanel Margin="5">
                <Border BorderBrush="Black" BorderThickness="2" CornerRadius="5">
                    <TextBlock HorizontalAlignment="Center">Setup Stage</TextBlock>
                </Border>
            <sap:WorkflowItemsPresenter 
                 Items="{Binding Path=ModelItem.SetupActivities}" Style="{StaticResource ResourceKey=mysequence}"
                 HintText="Insert Setup Activities Here">
                </sap:WorkflowItemsPresenter>

            </StackPanel>
        </Border>
        <Border BorderBrush="Blue" BorderThickness="4" CornerRadius="5" Margin="0 5">
            <StackPanel Margin="5">
                <Border BorderBrush="Black" 
                    BorderThickness="2" CornerRadius="5">
                    <TextBlock 
                        HorizontalAlignment="Center">Execution Stage</TextBlock>
                </Border>
                <sap:WorkflowItemsPresenter 
                 Items="{Binding Path=ModelItem.Activities}" 
                 HintText="Insert Execution Activities Here" Style="{StaticResource ResourceKey=mysequence}">
                </sap:WorkflowItemsPresenter>
            </StackPanel>
        </Border>
        
        <Border BorderBrush="Red" BorderThickness="4" CornerRadius="5" Margin="0,5">
            <StackPanel Margin="5">
                <Border BorderBrush="Black" BorderThickness="2" CornerRadius="5">
                    <TextBlock HorizontalAlignment="Center">CleanUp Stage</TextBlock>
                </Border>
                <sap:WorkflowItemsPresenter 
                 Items="{Binding Path=ModelItem.CleanUpActivities}" 
                 HintText="Insert CleanUp Activities Here" Style="{StaticResource ResourceKey=mysequence}">
                </sap:WorkflowItemsPresenter>
            </StackPanel>
        </Border>
    </StackPanel>

</sap:ActivityDesigner>
